home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / yahtze1a / frmstats.frm (.txt) < prev    next >
Visual Basic Form  |  1999-09-26  |  6KB  |  160 lines

  1. VERSION 5.00
  2. Begin VB.Form frmStats 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H80000005&
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "Your Statistics"
  7.    ClientHeight    =   2055
  8.    ClientLeft      =   45
  9.    ClientTop       =   330
  10.    ClientWidth     =   4305
  11.    ControlBox      =   0   'False
  12.    LinkTopic       =   "Form1"
  13.    LockControls    =   -1  'True
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    Picture         =   "frmStats.frx":0000
  17.    ScaleHeight     =   2055
  18.    ScaleWidth      =   4305
  19.    ShowInTaskbar   =   0   'False
  20.    StartUpPosition =   1  'CenterOwner
  21.    Begin VB.Image imgReset 
  22.       Height          =   330
  23.       Left            =   480
  24.       Picture         =   "frmStats.frx":1CF2
  25.       Top             =   1560
  26.       Width           =   1095
  27.    End
  28.    Begin VB.Image imgOK 
  29.       Height          =   330
  30.       Left            =   2760
  31.       Picture         =   "frmStats.frx":1FDF
  32.       Top             =   1560
  33.       Width           =   1095
  34.    End
  35.    Begin VB.Label lblTotalAvgScore 
  36.       Alignment       =   1  'Right Justify
  37.       Appearance      =   0  'Flat
  38.       AutoSize        =   -1  'True
  39.       BackColor       =   &H80000005&
  40.       BackStyle       =   0  'Transparent
  41.       Caption         =   "0"
  42.       BeginProperty Font 
  43.          Name            =   "MS Sans Serif"
  44.          Size            =   8.25
  45.          Charset         =   0
  46.          Weight          =   700
  47.          Underline       =   0   'False
  48.          Italic          =   0   'False
  49.          Strikethrough   =   0   'False
  50.       EndProperty
  51.       ForeColor       =   &H80000008&
  52.       Height          =   195
  53.       Left            =   3360
  54.       TabIndex        =   3
  55.       Top             =   960
  56.       Width           =   120
  57.    End
  58.    Begin VB.Label lblTGPlayed 
  59.       Alignment       =   1  'Right Justify
  60.       Appearance      =   0  'Flat
  61.       AutoSize        =   -1  'True
  62.       BackColor       =   &H80000005&
  63.       BackStyle       =   0  'Transparent
  64.       Caption         =   "0"
  65.       BeginProperty Font 
  66.          Name            =   "MS Sans Serif"
  67.          Size            =   8.25
  68.          Charset         =   0
  69.          Weight          =   700
  70.          Underline       =   0   'False
  71.          Italic          =   0   'False
  72.          Strikethrough   =   0   'False
  73.       EndProperty
  74.       ForeColor       =   &H80000008&
  75.       Height          =   195
  76.       Left            =   3360
  77.       TabIndex        =   2
  78.       Top             =   600
  79.       Width           =   120
  80.    End
  81.    Begin VB.Label lblAverageScores 
  82.       Alignment       =   1  'Right Justify
  83.       Appearance      =   0  'Flat
  84.       BackColor       =   &H80000005&
  85.       BackStyle       =   0  'Transparent
  86.       Caption         =   "Average Score:"
  87.       ForeColor       =   &H80000008&
  88.       Height          =   255
  89.       Left            =   1320
  90.       TabIndex        =   1
  91.       Top             =   960
  92.       Width           =   1455
  93.    End
  94.    Begin VB.Label lblTotalGames 
  95.       Alignment       =   1  'Right Justify
  96.       Appearance      =   0  'Flat
  97.       AutoSize        =   -1  'True
  98.       BackColor       =   &H80000005&
  99.       BackStyle       =   0  'Transparent
  100.       Caption         =   "Total Games Played:"
  101.       ForeColor       =   &H80000008&
  102.       Height          =   195
  103.       Left            =   1305
  104.       TabIndex        =   0
  105.       Top             =   600
  106.       Width           =   1470
  107.    End
  108. Attribute VB_Name = "frmStats"
  109. Attribute VB_GlobalNameSpace = False
  110. Attribute VB_Creatable = False
  111. Attribute VB_PredeclaredId = True
  112. Attribute VB_Exposed = False
  113. Option Explicit
  114. Private Sub imgOK_Click()
  115.   '//Unload form
  116.   Unload Me
  117. End Sub
  118. Private Sub imgOK_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  119.   '//Change picture to down pic
  120.   imgOK.Picture = frmMain.ImageList1.ListImages(4).Picture
  121. End Sub
  122. Private Sub imgOK_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  123.   '//Change pic back to normal
  124.   imgOK.Picture = frmMain.ImageList1.ListImages(3).Picture
  125. End Sub
  126. Private Sub imgReset_Click()
  127.   Call ResetStats '//Reset was clicked, set back to default in registry
  128.   Call InitStats '//Call sub to update the on screen stats to default
  129. End Sub
  130. Private Sub imgReset_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  131.   '//Change picture to down pic
  132.   imgReset.Picture = frmMain.ImageList1.ListImages(6).Picture
  133. End Sub
  134. Private Sub imgReset_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  135.   '//Change picture to up pic
  136.   imgReset.Picture = frmMain.ImageList1.ListImages(5).Picture
  137. End Sub
  138. Private Sub Form_Load()
  139.   Call InitStats '//Call sub to update the on screen stats to registry values
  140. End Sub
  141. Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
  142.   '//User pressed the escape key
  143.   If KeyCode = vbKeyEscape Then Unload Me
  144. End Sub
  145. Private Sub InitStats()
  146. Dim Stat1 As Long '//Tracks total games played
  147. Dim Stat2 As Long '//Tracks total score of all games played
  148.   Stat1 = CLng(GetSetting(MyApp, "Settings", "GamesPlayed")) '//Get value from registry
  149.   Stat2 = CLng(GetSetting(MyApp, "Settings", "TotalScore")) '//Get value from registry
  150.   If Stat1 = 0 Then '//Games played was zero, just update onscreen values to zero
  151.     lblTGPlayed.Caption = "0"
  152.     lblTotalAvgScore.Caption = "0"
  153.   Else
  154.   '//Set viewable games played total to registy value
  155.   lblTGPlayed.Caption = Stat1
  156.   '//Average the score based on games played and total score
  157.   lblTotalAvgScore.Caption = Round((Stat2 / Stat1), 0)
  158.   End If
  159. End Sub
  160.